Calendar
The Calendar API in the Scripting app provides access to iOS calendars, calendar accounts, and event/reminder management.
Developers can retrieve default calendars, create new ones, list calendars supporting specific entity types, and manage calendar properties.
Type Definitions
CalendarType
Represents types of calendars:
CalendarSourceType
Represents the type of calendar account source:
CalendarEventAvailability
Represents event availability settings:
CalendarEntityType
Represents types of entities calendars can manage:
Class: CalendarSource
Represents a calendar account source (e.g., Local, Exchange).
Properties
Methods
getCalendars(entityType: CalendarEntityType): Promise<Calendar[]>
Gets the list of calendars for this source based on entity type.
- Parameters
entityType: CalendarEntityType— The entity type to retrieve.
- Returns
Promise<Calendar[]>— An array of calendar objects.
Class: Calendar
Represents a calendar object that manages events and reminders.
Properties
Methods
remove(): Promise<void>
Deletes the calendar.
save(): Promise<void>
Saves changes to the calendar.
static defaultForEvents(): Promise<Calendar | null>
Gets the default event calendar set by the system.
static defaultForReminders(): Promise<Calendar | null>
Gets the default reminder calendar set by the system.
static forEvents(): Promise<Calendar[]>
Lists all calendars that support events.
static forReminders(): Promise<Calendar[]>
Lists all calendars that support reminders.
static create(options: { title: string, entityType: CalendarEntityType, sourceType: CalendarSourceType, color?: Color }): Promise<Calendar>
Creates a new calendar.
- Parameters
title: string— Calendar titleentityType: CalendarEntityType— Supported entity typesourceType: CalendarSourceType— Account source typecolor?: Color— (Optional) Calendar color
- Returns
Promise<Calendar>— The newly created calendar.
static presentChooser(allowMultipleSelection?: boolean): Promise<Calendar[]>
Presents a calendar chooser view.
- Parameters
allowMultipleSelection?: boolean— Allow multiple selection, defaultfalse.
- Returns
Promise<Calendar[]>— Selected calendars.
static getSources(): CalendarSource[]
Retrieves all available calendar sources on the device.
